{include file="Public:header" /}
 <link rel="stylesheet" href="__PUBLIC__/Admin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" media="screen"/>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加奖品</h5>
                        <div class="ibox-tools" style="margin-top: -6px;">
                            <button onclick="history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form action="__URL__/addPrize" method="post" id="defaultForm" class="form-horizontal">
                            <!--
                            <div class="form-group">
                                <label class="col-sm-2 control-label">奖品类型</label>
                                 <div class="col-sm-6">
                                     <select onchange="isChange(this);" name="prize_type" class="form-control">
                                        <option value="1">现金抵用券</option>
                                        <option value="2">实物兑换券</option>
                                        <option value="4">商品类型兑换券</option>
                                        <option value="3">谢谢参与</option>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->

                           <!-- <div class="form-group goodstype">
                                <label class="col-sm-2 control-label">商品类型</label>
                                <div class="col-sm-6">
                                    <select name="cat_id" class="form-control" id="typelist">
                                        <option value="">请选择商品类型</option>

                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed goodstype"></div>-->


                            <!--<div class="form-group">
                                <label class="col-sm-2 control-label">兑换券&nbsp;&nbsp;/&nbsp;&nbsp;抵用券名称</label>
                                 <div class="col-sm-6">
                                    <input type="text" name="voucher_name" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->

                            <!--<div class="form-group type_momey">
                                <label class="col-sm-2 control-label">价值</label>
                                <div class="col-sm-6">
                                    <input type="text" name="type_momey" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed type_momey"></div>-->

                            <!--<div class="form-group min_goods_amount">
                                <label class="col-sm-2 control-label">使用商品最低金额</label>
                                <div class="col-sm-6">
                                    <input type="text" name="min_goods_amount" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed min_goods_amount"></div>-->

                            <div class="form-group">
                                <label class="col-sm-2 control-label">奖品名称</label>
                                 <div class="col-sm-6">
                                    <input type="text" name="prize_name" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <!--<div class="form-group goods_sn_html">
                                <label class="col-sm-2 control-label">实物货号</label>
                                <div class="col-sm-6">
                                    <input type="text" name="goods_sn" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed goods_sn_html"></div>-->

                            <div class="form-group">
                                <label class="col-sm-2 control-label">奖品数量</label>
                                 <div class="col-sm-6">
                                    <input type="text" name="prize_num" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">剩余数量</label>
                                <div class="col-sm-6">
                                   <input type="text" name="surplus_num" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <!--<div class="form-group">
                                <label class="col-sm-2 control-label">奖品描述</label>
                                 <div class="col-sm-6">
                                 <textarea rows="5" name="prize_describe" class="form-control"></textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->
                            
                             <!--<div class="form-group">
                                <label class="col-sm-2 control-label">中奖概率(%)</label>
                                <div class="col-sm-6">
                                   <input type="text" name="rate" readonly class="form-control">
                                   <span class-"help-block"><i class="fa fa-info-circle"></i> 中奖概率 = 奖品数量 / 全部奖品数量总和</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> -->


                            <!--<div class="form-group is_shipping">
                                <label class="col-sm-2 control-label">是否包邮</label>
                                <div class="i-check col-sm-6">
                                <input type="radio" name="is_shipping" value="1"
                                    checked="checked" />
                                是
                                <input type="radio" name="is_shipping" value="0" />
                                否
                                </div>
                            </div>
                            <div class="hr-line-dashed is_shipping"></div>-->

                            <!--<div class="form-group form-inline" >
                                <label class="col-sm-2 control-label">红包有效期</label>
                                <div class="col-sm-8">
                                    <div class="col-sm-4 input-group date" id="datetimepicker6">
                                        <input type="text" name="use_start_date" class="form-control">
                                        <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                        <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
                                    </div>

                                    <div class="col-sm-4 input-group date" id="datetimepicker7">
                                        <input type="text" name="use_end_date" class="form-control">
                                        <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                        <span class="input-group-addon">
						                    <span class="fa fa-calendar"></span>
						                </span>
                                    </div>
                                    <br/>
                                     <span class-"help-block"><i class="fa fa-info-circle"></i> 必填</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->


                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否启用该奖品</label>
                                <div class="i-check col-sm-6">
                                <label class="checkbox-inline">
                                   <input type="radio" name="status" value="1"
                                    checked="checked" /> 是
                                 </label>
                                
                                <label class="checkbox-inline">
                                   <input type="radio" name="status" value="2" /> 否
                                 </label>
                               
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                             <!--<div class="form-group">
                                <label class="col-sm-2 control-label">每天最多中奖数量</label>
                                <div class="col-sm-6">
                                   <input type="text" name="max_winning" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->

                            <!--<div class="form-group">
                                <label class="col-sm-2 control-label">备注</label>
                                <div class="col-sm-6">
                                   <input type="text" name="note" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>-->
                            
                            <!--<div class="form-group return_url">
                                <label class="col-sm-2 control-label">链接跳转</label>
                                <div class="col-sm-6">
                                   <input type="text" name="url" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed return_url"></div>-->


                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-white" type="submit">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
				</div>
			</div>
		</div>
	</div>


	{include file="Public:footer" /}
<script>
$(document).ready(function(){
        $.ajax({
         url : '__URL__/prizeTypeList',
         type : 'get',
         dataType : 'json',
         success : function(data) {
             if(data.state == 0)
                $('#typelist').append(data.option_list);
         }
         });
    });

window.onload=isChange();	
function isChange(obj){
	
	var v = $(obj).val();
	if(v == undefined){
		v = 1;
	}
	//红包
	if(v == 1){
		$(".goods_sn_html").hide();
		$(".is_shipping").hide();
        $(".goodstype").hide();
	//实物
	}else if(v == 2){
		$(".goods_sn_html").show();
		$(".is_shipping").show();
		$(".min_goods_amount").hide();
        $(".goodstype").hide();
        //商品类型
    }else if (v == 4)
    {
        $(".goods_sn_html").hide();
        $(".min_goods_amount").show();
        $(".is_shipping").hide();
        $(".goodstype").show();
	//谢谢参与
	}else{
        $(".goodstype").hide();
		$(".type_momey").hide();
		$(".min_goods_amount").hide();
		$(".goods_sn_html").hide();
		$(".bonus-time").hide();
		$(".is_shipping").hide();
		$(".return_url").hide();
	}
}
</script>
	<script>
$(document).ready(function() {
    /**
     * 下面是进行插件初始化
     * 你只需传入相应的键值对
     * */

    $('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {/*输入框不同状态，显示图片的样式*/
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {/*验证*/
            prize_name: {/*键名username和input name值对应*/
                message: '奖品名称验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '奖品名称不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 2,
                        max: 30,
                        message: '奖品名称长度必须在2到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            prize_num: {/*键名username和input name值对应*/
                message: '奖品数量验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '奖品数量不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 1,
                        max: 30,
                        message: '奖品数量长度必须在1到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            max_winning:{/*键名username和input name值对应*/
                message: '每天最多中奖数量验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '每天最多中奖数量不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 1,
                        max: 30,
                        message: '每天最多中奖数量长度必须在1到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            min_goods_amount: {/*键名username和input name值对应*/
                message: '使用商品最低金额验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '使用商品最低金额不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 1,
                        max: 30,
                        message: '使用商品最低金额必须在2到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            type_momey: {/*键名username和input name值对应*/
                message: '实物劵价值验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '实物劵价值不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 1,
                        max: 30,
                        message: '实物劵价值必须在1到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            goods_sn: {/*键名username和input name值对应*/
                message: '实物货号验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '实物货号不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 2,
                        max: 30,
                        message: '实物货号必须在2到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            voucher_name: {/*键名username和input name值对应*/
                message: '券名验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '券名不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 2,
                        max: 30,
                        message: '券名必须在2到30之间'
                    }/*最后一个没有逗号*/
                }
            },
            surplus_num:{/*键名username和input name值对应*/
                message: '剩余数量验证失败',
                validators: {
                    notEmpty: {/*非空提示*/
                        message: '剩余数量不能为空'
                    },
                    stringLength: {/*长度提示*/
                        min: 1,
                        max: 30,
                        message: '剩余数量必须在1到30之间'
                    }/*最后一个没有逗号*/
                }
            }


        }
        // 还有一个比较常用的就是submitHandler属性，它对应着提交按钮的事件方法。
        // submitHandler: function (validator, form, submitButton) {
        //alert("submit");
        /*  var menu_name = $("input[name='menu_name']").val();
         var link = $("input[name='link']").val();
         var ico = $("input[name='ico']").val();
         $.ajax({
         url : '__URL__/addMenu',
         type : 'get',
         data : {'menu_name' : menu_name, 'link' : link, 'ico':ico},
         dataType : 'json',
         success : function(data){
         alert(data.message);
         }
         }); */
        // }
    });

});

</script>

<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

<script type="text/javascript">
        $('#datetimepicker6').datetimepicker({
             language:  'zh-CN',
             format: 'yyyy-mm-dd hh:ii',
             autoclose:true//日期选择完成后是否关闭选择框
        });
        $('#datetimepicker7').datetimepicker({
            language:  'zh-CN',
            format: 'yyyy-mm-dd hh:ii',
            autoclose:true //Important! See issue #1075
        });
   
</script>

</body>
</html>
